<div class="clear">
  <div class="left-box ovf fl">
    <div class="clear"><h1 class="ph"><%= category.title %><small><%= category.metadata && category.metadata['副标题'] %></small></h1></div>
    <div class="clear fl" style="margin-right: 50px; text-align: center; margin-bottom: 30px;">
      <div style="width: 230px; height: 200px; background: url(/images/wx.png) center no-repeat; background-size: 150px;"></div>
      <h3 class="c32" style="font-weight: bold;">公共服务中心公众号</h3>
    </div>
    <div class="fl mid">
      <ul>
        <% children.keys.each_with_index do |category, index| %>
          <li class="<%= index % 2 == 0 ? 'b1' : 'b2' %>"> <div class="icon-bg fl"><img src="images/icon<%= index + 1 %>.png"></div> <div class="fl">  <p class="f14 b c32 fyh"><%= category.title %></p>  <p class="lh18"><% category.pages.order(:position).each do |page| %><a href="<%= page.url %>">· <%= page.title %></a><% end %></p>  </div>  </li>
        <% end %>
      </ul>
    </div>
  </div>

  <div class="fr-box ovf fr">
    <div class="news-box" id="con">
      <% category1 = Cip::Category.find_by(slug: 'policies') %>
      <% category2 = Cip::Category.find_by(slug: 'news') %>
      <ul id="tags">
        <li class="fyh f20  selectTag"><a onClick="selectTag('tagContent0',this)" href="javascript:void(0)"><%= category1.title %></a></li>
        <li class="fyh f20 " ><a onClick="selectTag('tagContent1',this)" href="javascript:void(0)"><%= category2.title %></a></li>
      </ul>
      <div id="tagContent">
        <div class="tagContent selectTag fl" id="tagContent0">
          <% category1.pages.order(created_at: :desc).first(7).each do |page| %>
            <p><img src="images/dot.png">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="<%= page.url %>"><%= truncate page.title, length: 15 %></a><span style="float:right"><%= l page.created_at.to_date, format: :short %></span></p>
          <% end %>
        </div>
        <div class="tagContent  fl" id="tagContent1">
          <% category2.pages.order(created_at: :desc).first(7).each do |page| %>
            <p><img src="images/dot.png">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="<%= page.url %>"><%= truncate page.title, length: 15 %></a><span style="float:right"><%= l page.created_at.to_date, format: :short %></span></p>
          <% end %>
        </div>
      </div>
    </div>
  </div>
</div>

<script type=text/javascript>
function selectTag(showContent,selfObj){
  // 操作标签
  var tag = document.getElementById("tags").getElementsByTagName("li");
  var taglength = tag.length;
  for(i=0; i<taglength; i++){
    tag[i].className = "";
  }
  selfObj.parentNode.className = "selectTag";
  // 操作内容
  for(i=0; j=document.getElementById("tagContent"+i); i++){
    j.style.display = "none";
  }
  document.getElementById(showContent).style.display = "block";
}
</script>
